<?php

declare(strict_types=1);

namespace App\Lib\WeApp\Support;

use App\Lib\WeApp\Support\Abstract\MessageAbstract;

/**
 * @property string $Event
 * @property string $MsgType
 */
class Message extends MessageAbstract
{
    //
    public function offsetExists($offset): bool
    {
        return isset($this->attributes[$offset]);
    }

    public function offsetGet($offset): mixed
    {
        return isset($this->attributes[$offset]) ? $this->attributes[$offset] : null;
    }

    public function offsetSet($offset, $value): void
    {
        if (is_null($offset)) {
            $this->attributes[] = $value;
        } else {
            $this->attributes[$offset] = $value;
        }
    }

    public function offsetUnset($offset): void
    {
        unset($this->attributes[$offset]);
    }

    public function jsonSerialize(): array
    {
        // TODO: Implement jsonSerialize() method.
        return $this->attributes;
    }
}
